<!-- 头部 -->
<include file="Public:header" />
<link rel="stylesheet" href="__PUBLIC__/home/css/goods.css">
<!-- 前端框架 -->
<link href="__PUBLIC__/css/layui.css" rel="stylesheet" type="text/css" media="all"/>
<script type="text/javascript" src="__PUBLIC__/layui.js"></script>

        <!-- 头部 -->
        <div class="consumerTop">
            <div class="container">
                <div class="index_consumerTopNav clearfix">
                    <div class="consumerLogo fl paddingTop10"><a href="{:U('home/index/index')}"><img src="__PUBLIC__/home/images/logo3.png" alt="" /></a></div>
                    <div class="consumerBoxUl fr js_consumerUl">
                        <ul class="clearfix consumerUl consumerUlList">
                            <li id=""><a href="{:U('home/index/index')}">首页</a></li>
                            <li id="yunyi_consumerTop"><a href="{:U('home/Dingzhi/index')}">所有成品</a></li>
                            <li id="consult_consumerTop"><a href="{:U('home/news/index')}">时尚资讯</a></li>
                            <li id="index_consumerTop"><a href="{:U('home/xuqiu/index')}">预约定制</a></li>
                        </ul> 
                    </div>
                </div>
            </div>
        </div>
	<div class="container moveOn">
		<section class="bigContentWrap goodsTable moveOn">
			<dl>
				<dt>
					<h1>发布需求</h1>
				</dt>
				<dd>
					<form class="layui-form" method="post">
                        <table cellspacing="0" cellpadding="0">
                            <tr>
                                <td width="125" align="right"><span class="colorRed">*</span>姓名：</td>
                                <td width="427">
                                    <input type="text" name="name" required  lay-verify="required" placeholder="请输入姓名">
                                </td>
                                <td width="125" align="right"><span class="colorRed">*</span> 预算：</td>
                                <td width="423">
                                    <input type="text" name="budget" required  lay-verify="required" placeholder="请输入预算">
                                </td>
                            </tr>
                            <tr>
                                <td width="125"  align="right"><span class="colorRed">*</span> 联系手机：</td>
                                <td width="300">
                                    <input type="text" name="phone" required  lay-verify="required" placeholder="请输入手机">
                                </td>
                                <td width="125"  align="right"><span class="colorRed">*</span> 数量：</td>
                                <td width="300">
                                    <input type="text" name="num" required  lay-verify="required" placeholder="请输入数量">
                            </tr>
                            <tr>
                                <td width="125" align="right"><span class="colorRed">*</span> 详细地址：</td>
                                <td width="300">
                                    <input type="text" name="addr" required  lay-verify="required" placeholder="请输入详细地址"></td>
                                <td width="125" align="right"><span class="colorRed">*</span> 联系QQ：</td>
                                <td width="300">
                                    <input type="text" name="qq" required  lay-verify="required" placeholder="请输入联系人QQ">
                                </td>
                            </tr>
                        </table>
						<table cellspacing="0" cellpadding="0">
							<tr>
								<td width="115" align="right">需求描述：</td>
								<td width="905">
									<textarea class="layui-textarea" name="content" id="LAY_demo1"></textarea>
								</td>
							</tr>
							<tr>
								<td height="80" colspan="2" align="center">
									<button lay-submit lay-filter="*" style="background-color: #eba524;display: block;width: 180px;height: 46px;border:0px;color:#fff;">提交需求</button>
								</td>
							</tr>
						</table>
					</form>
				</dd>
			</dl>
		</section>
	</div>


<!-- 尾部 -->
<include file="Public:fooder" />


<script type="text/javascript">
    layui.use(['form','layedit'], function(){
      var layer = layui.layer
      ,layedit = layui.layedit
      ,form = layui.form();
      //layer.msg('Hello World');

  //创建一个编辑器
  var editIndex = layedit.build('LAY_demo1', {height: 200,
                tool: ['strong','italic','underline','del','left', 'center', 'right', '|', 'face','link']
                });

    form.on('submit(*)', function(data){

    	data.field.content = layedit.getContent(editIndex);

        $.ajax({
            url: "{:U('home/xuqiu/xuqiu_add')}",//请求地址
            type: "post",//请求方式
            dataType: "json",//返回数据类型
            data: data.field,//发送的参数
            })
            .done(function(response) {
                  if(response.error==0){
                     layer.msg(response.info ,{icon:5});

                  }else{
                     layer.msg(response.info ,{icon:6});
                     location.href = "{:U('home/index/index')}";
                  }
              })
            .fail(function() {
                alert("ajxs交互失败");
            })  

          return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });  
    });
</script>
</body>
</html>
